package 排序;

/**
 * @Author: biubiu0002
 * @Date: 2021-03-26 19:55
 **/
public class 冒泡 {

    public void bubbleSort(int nums[]){
        for(int i=0;i<nums.length;i++){
            for(int j=0;j<nums.length-1-i;j++){
                if(nums[j]>nums[j+1]){
                    int temp = nums[j];
                    nums[j]=nums[j+1];
                    nums[j+1]=temp;

                }

            }
        }


    }

    public static void main(String[] args) {
        int[] nums = {3,5,2,4,1,8,6,7};
        for(int i=0;i<nums.length;i++){
            System.out.print(nums[i]);
        }
        new 冒泡().bubbleSort(nums);
        System.out.println();
        for(int i=0;i<nums.length;i++){
            System.out.print(nums[i]);
        }


    }
}
